﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once
#include "GcmpModelInterface.h"
#include "IElement.h"
#include "GbmpQuickCast.h"
#include <cstdint>
namespace gcmp
{
    class IDocument;
    class ElementId;

    /// \brief 1对1元素关系接口
    class GCMP_MODEL_INTERFACE_EXPORT IOneToOneElementRelationship : public IElement
    {
        DEFINE_CAST_DERIVED(gcmp::IOneToOneElementRelationship, gcmp::IElement)
    public:
        /// \brief 创建关系对象
        /// \param pDocument 所属文档
        /// \param type 关系类型
        /// \param firstPartId 甲方Id
        /// \param secondPartId 乙方Id
        static IOneToOneElementRelationship * Create(
            IDocument * pDocument,
            int32_t type,
            const ElementId & firstPartId,
            const ElementId & secondPartId
        );

        /// \brief 获取关系类型
        /// \return 关系类型，由使用者定义
        virtual int32_t GetType() const = 0;

        /// \brief 设置关系类型
        /// \param type 关系类型，由使用者自定义、区分
        virtual void SetType(int32_t type) = 0;

        /// \brief 获取甲方
        /// \return 甲方对象Id
        virtual ElementId GetFirstPart() const = 0;

        /// \brief 设置甲方
        /// \param partId 甲方对象Id
        virtual void SetFirstPart(const ElementId & partId) = 0;

        /// \brief 获取乙方
        /// \return 乙方对象Id
        virtual ElementId GetSecondPart() const = 0;

        /// \brief 设置乙方
        /// \param partId 乙方对象Id
        virtual void SetSecondPart(const ElementId & partId) = 0;

        /// \brief 析构函数
        virtual ~IOneToOneElementRelationship() = 0;
    };
}
